﻿/// ---------------------------------------------
///
/// 江懷玉
///
/// ---------------------------------------------

///----------------------------------------------
///2012.4.30 汪定新 添加
///双击事件
function CustomDbClick() {
    fnCustomEdit();
}
///----------------------------------------------

var fnCustomAdd = function () {
    document.getElementById("dialog1_h").innerHTML = "添加工作经历";
    document.getElementById("EditUIWindow").src = "AutoLoadForm.aspx?r=" + Math.random() + "&entity=" + const_EditEntity;
    SetDWH(450, 300, YAHOO.example.container.dialog1);
    YAHOO.example.container.dialog1.show();
}
var fnCustomEdit = function () {
    document.getElementById("dialog1_h").innerHTML = "修改工作经历";
    var recordID = myDataTable.getSelectedRows()[0];
    record = myDataTable.getRecord(recordID);
    if (record == null) {
        alert("请选择一条记录");
        return;
    }
    document.getElementById("EditUIWindow").src = "AutoLoadForm.aspx?r=" + Math.random() + "&entity=" + const_EditEntity + "&id=" + record.getData(const_entityID);
    SetDWH(450, 300, YAHOO.example.container.dialog1);
    YAHOO.example.container.dialog1.show();
}

var fnAddEduHistory = function () {
}

if (typeof ($) != "undefined") {
    $(document).ready(function () {
        //$("#IDCardNO").bind('blur', fnChekcIDCard);
        try {
            if (getPar1('id') == "") {
                //alert(parent.parent.getPar1('id'));
                instance[0].EmployeeID = parent.parent.getPar1('id');
            }
        } catch (e) { 
        }

        var btn = parent.parent.parent.document.getElementById("yui-gen7-button");
        $(btn).hide();
    });
}

var fnCheckData = function () {
    if ($("#CompanyName").val() == "") {
        return "公司名称不能为空!"
    }
    if ($("#Department").val() == "") {
        return "部门不能为空!";
    }
    if ($("#Title").val() == "") {
        return "职位不能为空!";
    }

    if ($("#BeginDate").val() == "") {
        return "入职日期不能为空!"
    }
    if ($("#EndDate").val() == "") {
        return "离职日期不能为空!"
    }

    var begin = $("#BeginDate").val();
    var end = $("#EndDate").val();
    if (begin > end) {
        return "入职日期>离职日期，不允许!";
    }
}